package com.spring.boot.quartz.config;

import org.cleaver.spring.application.ApplicationContextUtil;
import org.springframework.context.ApplicationContext;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.ComponentScan;
import org.springframework.context.annotation.Configuration;
import org.springframework.scheduling.quartz.QuartzJobBean;

import javax.annotation.Resource;
import java.util.HashMap;
import java.util.Map;

/**
 * @author LiKun
 * @date 2021/7/30 16:25
 */
@Configuration
@ComponentScan({"com.aspect", "com.knife"})
public class ApplicationConfig {
    @Resource
    private ApplicationContext applicationContext;

    @Bean("jobInit")
    public Map<String, QuartzJobBean> jobInit() {
        return new HashMap<>(8);
    }

    @Bean
    public ApplicationContextUtil applicationContextUtil() {
        ApplicationContextUtil applicationContextUtil = new ApplicationContextUtil();
        applicationContextUtil.setApplicationContext(applicationContext);
        return applicationContextUtil;
    }
}
